package com.xjj.datarources.config;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @name: xjj
 * @date: 2021/6/2 13:17
 */

@Component
public class WorkReceiveListener {

    /**
     * 添加上这个注解，会自动把队列中的消息进行消费，这个是我们不希望的，
     * 因为我们需要进行手动消费确认，然后根据消费情况进行接下来的业务
     * @param msg
     */
    //@RabbitListener(queues = "queue_work")
    public void receiveMsg(String msg){
        System.out.println("第一个接收到消息: "+msg);
    }

    //@RabbitListener(queues = "topic.work1")
    public void receiveMsg2(Object o){
        System.out.println("第二个接收到消息: "+o.toString());
    }

    //@RabbitListener(queues = "topic.work2")
    public void receiveMsg3(Object o){
        System.out.println("第三个接收到消息: "+o.toString());
    }


}
